


<!-- 患者列表 -->
<template>
    <div class="page-box h100 display-flex czbj">
        <p class="title-label">患者列表</p>

        <div>
            <!-- sonRouter="hzaddhz" -->
            <dxtable :headBtn="headBtn" :dataJson="dataJson" :portUrl="portUrl" :qx="qx" ref="databale"
                :formJson="formJson"></dxtable>
        </div>
    </div>
</template>
<script lang='ts' setup>
import dxtable from "../../components/util/dxtable.vue";
import sort from "../../components/util/sort.vue";
import { dxget, dxpost, qurl, hf,transferTimeYMD } from "../../util/index";
import { h, ref, reactive } from "vue";
const jjhsea = [{ label: "男", value: 1 }, { label: "女", value: 2 }]
const jjhseb = [{ label: "病种1", value: 1 }, { label: "病种2", value: 2 }]
const jjhsec = [{ label: "主治医生1", value: 1 }, { label: "主治医生2", value: 2 }]
const props = defineProps({
    pup: { type: String },
});
let headBtn = [];
const databale = ref();
const initeer = () => {
    databale.value.initDataExpose();
};
const emit = defineEmits(["callBack"]);
const classifyoptions = ref()
// 弹窗公用该列表

let dataJson = reactive([


    {
        title: "姓名",
        key: "name",
        search: true, // 是否在搜索栏展示
    },
    {
        title: "性别",
        key: "sex",
        render(row, index) {
            return jjhsea.filter(a=>a.value==row.sex)[0].label
        },
    }, {
        title: "病种",
        key: "entity",
        render(row, index) {
            return jjhseb.filter(a=>a.value==row.entity)[0].label
        },
    }, {
        title: "主治医生",
        key: "attendingDoctor",
        render(row, index) {
            return jjhsec.filter(a=>a.value==row.attendingDoctor)[0].label
        },
    }, {
        title: "到诊日期",
        key: "DateOfArrival",
        render(row, index) {
            return transferTimeYMD(row.DateOfArrival)
        },
        
    }, {
        title: "拿药时长",
        key: "TakingTime",
        width:180,
        render(row, index) {
            const jher = []
            if(row.TakingTime){
               
                row.TakingTime.split(",").map(a=>{
                    jher.push(transferTimeYMD(a))
                })
            }
            return jher.join("至")
        },
    }, {
        title: "用药情况",
        key: "drugUsage",
    }, {
        title: "患者来源",
        key: "PatientSource",
    }, {
        title: "回访信息",
        key: "ReturnVisitInformation",
        render(row, index) {
            return transferTimeYMD(row.ReturnVisitInformation)
        },
    },



    {
        title: "排序",
        width: 100,
        render(row) {
            row.databaseName = "testpatient";
            return h(sort, {
                row,
                onCallBack: () => {
                    initeer();
                },
            });
        },
    },
    {
        title: "创建时间",
        key: "addTime",
        width: "200",
        type: "daterange",
    },
]);
let portUrl = "patient/testpatient";
const qx = {
    DeletePermissionID: "hzlistdel", //删除
    EditPermissionIdentifier: "hzlistbj", // 编辑
    NewPermissionIdentifier: "hzlistxz", // 新建
    ViewPermissionID: "hzlistck", // 查看
};


let pupVal = props.pup;
let formJson = reactive([
    {
        title: "姓名",
        key: "name",
        type: "input",
        required: true, // 是否为必填
    },
    {
        title: "性别",
        key: "sex",
        type: "select",
        required: true, // 是否为必填
        val: 1,
        options: jjhsea,
      
    }, {
        title: "病种",
        key: "entity",
        type: "select",
        required: true, // 是否为必填
        val: 1,
        options: jjhseb
    }, {
        title: "主治医生",
        key: "attendingDoctor",
        type: "select",
        required: true, // 是否为必填
        val: 1,
        options: jjhsec
    }, {
        title: "到诊日期",
        key: "DateOfArrival",
        type: "date",
        val: new Date().getTime(),
    }, {
        title: "拿药时长",
        key: "TakingTime",
        type: "daterange",
        val: null
    }, {
        title: "用药情况",
        key: "drugUsage",
        type: "textarea",
        required: true, // 是否为必填
    }, {
        title: "患者来源",
        key: "PatientSource",
        type: "input",
        required: true, // 是否为必填
    }, {
        title: "回访时间",
        key: "ReturnVisitInformation",
        type: "datetime",

        val: new Date().getTime() + 1000 * 60 * 60 * 24 * 7,
    },
])
// const getcyyxconfig = async () => {
//     const { data }: any = await dxget('cyyx/cyyxconfig', { id: 1 })
//     classifyoptions.value = JSON.parse(data.data)
//     dataJson[2].options = [
//         {
//             label:"全部",
//             value:""
//         },
//         ...classifyoptions.value
//     ]
// }
// getcyyxconfig()
</script>


